At present, a network device, e.g. a router or a switch, after receiving a data packet from a line, replaces or modifies the head of the received data packet, and then transmit it to a destination port which is found by searching a routing table. The routing table is usually has the format as shown in FIG. 1.
Refer to FIG. 1, for example, after receiving the data packet whose identifier value is 4, the network device finds out the destination port whose port number is 1 corresponding to the identifier value 4 by searching the routing table, and then the network device transmits the data packet from the destination port whose port number is 1. In addition, in a data communication system, user services need to be protected, therefore, if there is a failure in the network device or on a communication link, user services should be switched to a backup device or a backup link in time in order to recover and the interruption time should be reduced as much as possible. Presently, a very important method of service protection is the switching route technique, which includes: when there is a service failure in one of the destination ports of a network device (herein and hereinafter a service failure in a destination port means that there is a failure on a communication link or in other network devices connected with the destination port), the network device will modify the corresponding port number of the destination port in its routing table, that is, changing the port number in the routing table corresponding to the fault destination port into the port number of the backup device or the backup link; thus, when receiving a data packet, by searching the modified routing table, the network device will transmit the data packet which was previously to be transmitted via the destination port in which there is a failure to the backup device or backup link via the backup port connecting the network device with the backup device or the backup link.
As shown in FIG. 1, in the routing table of the network device, different data packet identifiers may map to the port number of one destination port, that is, one port number of the destination port could appears several times repeatedly in the routing table. Thus, the network device needs to implement repetitious modifying operations when switching route and modifying the routing table. For instance, as shown in FIG. 1, suppose that the destination port whose port number is 0 is the backup port for the destination port whose port number is 3, when there is a service failure in the destination port whose port number is 3, all the destination port whose port number is 3 in the routing table shown in FIG. 1 should be modified into the destination port whose port number is 0; refer to FIG. 1, as there are many destination port whose port number is 3 in the routing table, the network device must search every destination port whose port number is 3, and modify the port numbers into the destination port whose port number is 0 respectively. However, the searching and modifying operations are repetitious, which leads to slow switching route. As a result, services at destination port whose port number is 3 of the network device could not be switched to the destination port whose port number is 0 in time and service interruption time becomes longer. In addition, because of repetitious searching and modifying operations for the same port number of the destination, the load of service on the CPU of the network device increases, thus the processing speed for other services is affected.